package group6renderer.renderernode;

import group6renderer.HTMLConstants;
import group6renderer.Visitor;
import group6renderer.Display;


/** CLASS NAME: BlockQuoteNode
 * DESCRIPTION: A class to deal with block quotes
 * COLABORATORING CLASSES: BranchNode, Display, Visitor
 * @author jonnie
 */
public class BlockQuoteNode extends BranchNode
{

	/**
	 * A Constructor to initialise the fields of a new BlockQuoteNode
	 * @param name the name of this node
	 */
    public BlockQuoteNode(String name)
    {
	this.name = name;
    }

    /** 
     * A method overriding the abstract method in TreeNode. It adjusts the properties of the State class according to the type of node
     * concerned.  
     * @param disp the Display object of the project (there is only one)
     * @Override
     */
    public void drawNode(Display disp)
    {
    	
    	if (goingDown && !isCopy)
    	{
    		if (lineChange1())
        		disp.crlf();
        	else
    		{disp.crlf();disp.crlf();}    		
    		disp.getState().toggleState(name);
    	}
  else if (!goingDown && !copied)
    	{
	  		disp.getState().toggleState(name);
    		if (lineChange2())
        		disp.crlf();
        	else
    		{disp.crlf();disp.crlf();}

    	}

    	goingDown=!goingDown;
    }

    /** 
     * A method to return whether this Node has a closing tag
     * @Override
     * @return true if this node has a closing tag and false otherwise
     */
    public boolean hasClosing()
    {
	return true;
    }

    /** 
     * A method to return a new copy of this node.
     * @Override
     * @return a new instance of this node with the original name
     */
    public TreeNode copy()
    {
	return new BlockQuoteNode(name);
    }

    /** 
     * A method to accept a Visitor so that its method can be called to visit this node. 
     * @param theVisitor references the Visitor interface
     * @Override
     */
    public void accept(Visitor theVisitor)
    {
	theVisitor.visit(this);
    }
}
